<?php
require_once 'connexion (2).php';
?>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
        <link rel="stylesheet" href="feuilledestyle.css">
        <link rel="stylesheet" href="menuHead/jquery.cleditor.css">
        <link href="menu2/styles.css" rel="stylesheet" type="text/css">
    </head>
    <body vlink="blue">
        <div id="page">
        <?php include 'header.php';?>
        <div id="cadre">
        <?php include 'menu.php';?>  
            <FORM style="float:left; margin-top: 20px; background-color: orange; "> <INPUT TYPE="button" VALUE="Retour" onClick="history.back()"> </FORM> 
                <div class="centre">
                    <br>
                             <a href="listeEntreprise.php"><img class="retour" title="retour" src="img/imgretour.jpg" width="44px"/></a>
                            <h3  style="margin-bottom: 124px;" >Infos de l'entreprises </h3>
                           <?php 
                                          $id2=null;
                                          
                                          if(!(isset($_GET["id"])))
                                          {
                                                    die("Parametre 'id' absent");
                                          }else{
                                                    $id2=$_GET["id"];
							
                                                    }
                                                    $connexion->exec("SET CHARACTER SET utf8");

                                        
                                              $req_rando="select * from entreprise where IDENTREPRISE=".$id2;
                                              
                                              $resu_ra=$connexion->query($req_rando);
                                              
                                                   if ($rep=$resu_ra->fetch(PDO::FETCH_ASSOC))
                                                   {
                                                       $id=$rep["IDENTREPRISE"];
                                                       $nomE=$rep["NOMENTREPRISE"];
                                                       $desc=$rep["DESCRIPTIONENTREPRISE"]; 
                                                       $adr=$rep["ADRESSEENTREPRISE"]; 
                                                       $tel=$rep["TELENTREPRISE"]; 
                                                       $mail=$rep["MAILENTREPRISE"]; 
                                                       echo '
                            <table id="tabinfgmoE" class="petitformdata" align="center"  border="01" style="margin-left: aukto; font-size:80%; margin-right: akuto;  color: slateggray; width:800px;">
                                <tr>    
                                    <th>Nom Entreprise : </th>
                                    <td style="float:left;">'.$nomE.'</td>
                                </tr>
                                <tr>
                                    <th>Description : </th>
                                    <td style="float:lefth; max-width:245px;">'.$desc.'</td>
                                </tr>
                                <tr>
                                    <th>Adresse : </th>
                                    <td style="float:left;">'.$adr.'</td>
                                </tr>
                                <tr>
                                    <th>Téléphone : </th>
                                    <td style="float:left;">'.$tel.'</td>
                                </tr>
                                <tr>
                                    <th>E-Mail : </th>
                                    <td style="float:left;">'.$mail.'<A HREF="envoieMail.php?adresse="'.$id2.'" onClick="window.open("envoieMail.php?adresse="'.$id2.'","_blank","toolbar=1, location=1, directories=2, status=1, scrollbars=1, resizable=1, copyhistory=0, menuBar=yes, width=550, height=300");return(false)"> Contacter</a></td>
                                </tr>
                            </table>
                       
                                                      '; }
                                          
                                              ?>
                  </div><br>
                 <div class="centre">
                           
                            <table border="1" class="petitformdata" align="center" >
                                <tr style="margin-left: auto; margin-right: auto;  color: slsategray;">    
                                    <th>Les Maîtres de stage de l'entreprise </th>
                                    <td border="1">nombres de stagiaires passés (
							<?php  $req_rando="select count(IDSTAGE) as nbSt from stage where IDENTREPRISE=".$id2." and ETATSTAGE in ('Affecté','Réalisé')";
																			  
																			  
								$resu_ra=$connexion->query($req_rando);
																			  
								if ($rep=$resu_ra->fetch(PDO::FETCH_ASSOC))
                                                                      {
									$nbS=$rep["nbSt"];
									echo '<i style="color:red;">'.$nbS.'</i>';
								      }
							?>									
				    )</td>
                                    
                                </tr>
                            </table>
                            <table border="1" class="petitformdata" align="center" >
                                <tr style="margin-left: auto; margin-right: auto; color: slfategray;">
                                    <th>Nom</th>
                                    <th>Prénom</th>
                                    <th>E-Mail</th>
                                    <th>Téléphone</th>
                                    
                                </tr>
				<?php
                                 
                               
                                        $req_INFO="select * from entreprise as en, maitrestage as m, personne as p where 
					 m.IDENTREPRISE=en.IDENTREPRISE AND p.IDPERSONNE=m.IDMAITRESTAGE and
					 en.IDENTREPRISE=".$id2." order by NOMPERSONNE";
						  											  
																			  
					$resu_IS=$connexion->query($req_INFO);
                                        					  
                                                while($rep=$resu_IS->fetch(PDO::FETCH_ASSOC))
                                                        {
                                                 $nomp=$rep["NOMPERSONNE"];
                                                 $pnomp=$rep["PRENOMPERSONNE"];
                                                 $mail=$rep["MAILPERSONNE"];
                                                 $tel=$rep["TELPERSONNE"];
                                                

                                       echo ' <tr style="margin-left: auto; margin-right: auto; color: dixmgrey;">
                                            <td>'.$nomp.'</td>
                                            <td>'.$pnomp.'</td>
                                            <td>'.$mail.'</td>
                                            <td>'.$tel.'</td>
                                        </tr>';
                                                        }
                                             	
								?>
                               
                            </table><br>
                      
                       
                 </div> 
        <?php require_once 'pied.php';?> 
        </div> 
    </div>
    </body>
</html>